let log4js=require('../logger');
module.exports = {
    //环境名称
    env: 'prod',
    //服务端口号
    port: 3000,
    core: {
        // origin: function (ctx) {
        //     console.log(ctx);
        //     if(ctx.get('origin')=='http://web.goodstersport.com'){
        //         return ctx.get('origin');
        //     }
        //     //ctx.set('Access-Control-Allow-Origin', '*');
        //     // if (ctx.url == '/tes/*') {
        //     //     //这样就能只允许 http://localhost:8080 这个域名的请求了
        //     //     return 'http://localhost:8080';
        //     // }
        //     // return "*"; // 允许来自所有域名请求
        //     //return "http://skip.goodstersport.com";
        //     return "*";
        // },
        credentials: true,
        //额外添加的返回给前端
        //exposeHeaders: ['WWW-Authenticate','Server-Authorization'],
        maxAge: 5,
        allowMethods: ['GET', 'POST', 'DELETE','PUT','OPTIONS'],
        allowHeaders: ['Content-Type', 'Origin', 'X-Requested-With','Accept','access-token',],
    },
    mongodb: {
        uri:'mongodb://root:bobo123321@119.28.192.216:27017/book-case?authSource=admin',
        db: 'Student'
    },
    auth:{
        access_key:"access-token",
        access_verify_key: "access-verify-token",
        access_token:'fsfsfsf3434fuerfsfnlfsjfsfsfgdgdgdgd&fdfdlfldf',
        salt: 'fsfsfsf3434fuerfsfnlfsjfsfsfgdgdgdgd&fdfdlfldf',
        wechatTtl: 3600 * 24 * 7,
        adminTtl: 3600 * 2,
        wechatLoginPrefix: "wechat:user:openid:",
        adminLoginPrefix: "admin:user:info:"
    },
    logger:{
        accessLogger: ()=> log4js.koaLogger(log4js.getLogger('access')),
        infoLogger: log4js.getLogger('applicationInfo'),
        errorLogger:log4js.getLogger('applicationError'),
        con: log4js.getLogger('out')
    },
    redis: {
        port: 6379,          // Redis port
        host: '119.28.192.216',   // Redis host
        //prefix: 'tb-ski:', //存诸前缀
        //ttl: 60 * 60 * 23,  //过期时间
        //family: 4,
        password: 'student@s45sf121',
        db: 0
    },
    wechat: {
        appId: 'wxccd10b571e444d6c',
        secret: '4b2afce152945860fc902ebb444050f1',
        tokenKey: 'wechat:prod:access:token:',
        expire: 7200,
    },
    wechatTemplate:{
        courseOrder:'UAvcaP8nUfyrawFgWvdWqeh-Ko6P2b-oIqBoz5kEnGo',
        courseEnd:'zdFzhJvMwVr4Lf7un0sjllR6G0P7GJzZkMoFkcil6E0'
    }
};
